<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  User: zhouyanchao
  Date: 2017/10/27
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>

<%--过去的日期--%>
<c:if test="${!operate}">
	<%--没有课程--%>
	<c:if test="${!course}">
		当天没有课程信息
	</c:if>
	<%--有课程--%>
	<c:if test="${course}">
		上午<input type="checkbox"  disabled <c:if test='${not empty courseMap["1"]}'>checked</c:if>>&nbsp;&nbsp;
		下午<input type="checkbox"  disabled <c:if test='${not empty courseMap["2"]}'>checked</c:if>>&nbsp;&nbsp;
		晚上<input type="checkbox"  disabled <c:if test='${not empty courseMap["3"]}'>checked</c:if>>
	</c:if>
	<br/>
	<button type="button" id="closeBtn">关闭</button>
</c:if>

<%--未来的日期--%>
<c:if test="${operate}">
	<%--没有课程--%>
	<c:if test="${!course}">
		上午<input type="checkbox" name="" value="1">&nbsp;&nbsp;
		下午<input type="checkbox" name="" value="2">&nbsp;&nbsp;
		晚上<input type="checkbox" name="" value="3">
	</c:if>
	<%--有课程--%>
	<c:if test="${course}">
		上午<input type="checkbox" value="1" <c:if test='${!courseMap["1"]}'> disabled </c:if> <c:if test='${not empty courseMap["1"]}'>checked</c:if>>&nbsp;&nbsp;
		下午<input type="checkbox" value="2" <c:if test='${!courseMap["2"]}'> disabled </c:if>  <c:if test='${not empty courseMap["2"]}'>checked</c:if>>&nbsp;&nbsp;
		晚上<input type="checkbox" value="3" <c:if test='${!courseMap["3"]}'> disabled </c:if>  <c:if test='${not empty courseMap["3"]}'>checked</c:if>>
	</c:if>
<br/>
	<button type="button" id="closeBtn">关闭</button>
	<button type="button" id="saveBtn">保存</button>
</c:if>

<script>
	$(function () {
		$('#closeBtn').click(function () {
			closeModal();
		});

		//保存按钮
		$('#saveBtn').click(function () {
			//获取已选择的checkbox（不包括disabled）
			var checks = '';
			$.each($(':checkbox:enabled:checked'),function (i,n) {
				console.log($(this).val());
				checks+=$(this).val()+",";

			});
			//ajax提交

			//提交后返回结果，关闭弹窗
			closeModal();
		});
	});
</script>